package com.vitas.coin.resp

import com.snap.base.util.BaseUtil
import com.snap.util.GsonUtil
import com.snap.util.log.SLog
import com.vitas.coin.callback.QueryAllCallback
import com.vitas.coin.data.event.QueryAllEvent
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext

object CollectResp {

    suspend fun update(mCallback: QueryAllCallback) {

        val recent = withContext(Dispatchers.IO) {
            CollectDaoResp.queryAll()
        }
        mCallback.getAllData(recent)
        if (recent.isNotEmpty()) {
            BaseUtil.postEvent(QueryAllEvent(recent))
        }

    }


}